//
//  FansRankViewController.m
//  CYWFrame
//
//  Created by Macx on 2017/10/12.
//  Copyright © 2017年 Macx. All rights reserved.
//

#import "FansRankViewController.h"
#import "CCZSegementController2.h"
#import "FansRankContentViewController.h"

@interface FansRankViewController ()

@end

@implementation FansRankViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self buildUI];
    
}

#pragma mark ==========构建UI==========
- (void)buildUI {
    
    self.view.backgroundColor = kWhiteColor;
    
    self.navigationItem.title = @"贡献榜";
    
    NSMutableArray *vcArr = [[NSMutableArray alloc] init];
    NSArray *titleArr = @[@"日榜", @"周榜", @"总榜"];
    NSArray *keyArr = @[@"day", @"week", @"all"];
    
    for (int i = 0; i < keyArr.count; i++) {
        FansRankContentViewController *rankVC = [[FansRankContentViewController alloc] init];
        rankVC.userId = self.userId;
        rankVC.titleName = titleArr[i];
        rankVC.keyWord = keyArr[i];
        [vcArr addObject:rankVC];
    }
    
    CCZSegementController2 *segement = [CCZSegementController2 segementControllerWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-64) titles:titleArr];
    [segement setSegementViewControllers:vcArr];
    
    segement.style = CCZSegementStyleDefault;
    [segement setSegementTintColor:UIMainColorRGB];
    [self.view addSubview:segement.view];
    [self addChildViewController:segement];
    [segement selectedNavAtIndex:^(NSInteger index) {
        NSLog(@"index %ld",index);
    }];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
